<template>

  <el-menu :default-active="pageindex" :unique-opened="true" :router="true">
    <template v-for="(item,index) in menuData">
      <!--有二级列表-->
      <el-submenu :index="''+index+''" v-if="item.dataList">
        <template slot="title">
          <i :class="item.icon"></i>{{item.title}}
        </template>
        <template v-for="(current,curIndex) in item.dataList">
          <!--无三级列表-->
          <el-menu-item :index="current.router" v-if="!current.isSub">{{current.name}}</el-menu-item>
          <!--有三级列表-->
          <el-submenu :index="''+index+'-'+curIndex+1+''" v-else>
            <template slot="title">{{current.subTit}}</template>
            <el-menu-item :index="chi.router" v-for="chi in current.children" :key="chi.router">{{chi.name}}
            </el-menu-item>
          </el-submenu>
        </template>
      </el-submenu>
      <!--无二级列表-->
      <el-menu-item :index="item.router" v-else>
        <i :class="item.icon"></i>{{item.title}}
      </el-menu-item>
    </template>
  </el-menu>
</template>

<script>
  export default {
    name: 'menuCom',
    data() {
      return {
        menuData:[
          {
            title:"组织管理",icon:"el-icon-menu",
            dataList:[
              {name:"乡镇管理",router:"/organManage/township",isSub:false},
              {name:"村管理",router:"/organManage/villageManage",isSub:false},
              {name:"人员管理",router:"/organManage/personManage",isSub:false},
              {name:"职务人员管理",router:"/organManage/jobPerson",isSub:false},
              {subTit:"机关党建",isSub:true,
                children:[
                  {name:"机关管理",router:"/organManage/partyBuild/partyManage"},
                  {name:"内容管理",router:"/organManage/partyBuild/ContentManage"},
                  {name:"人员管理",router:"/organManage/partyBuild/partyPManage"},
                ]
              },
              {subTit:"两新党建",isSub:true,
                children:[
                  {name:"企业管理",router:"/organManage/twoNewParty/busiManage"},
                  {name:"内容管理",router:"/organManage/twoNewParty/twoConManage"},
                  {name:"人员管理",router:"/organManage/twoNewParty/twoPManage"},
                ]
              },
            ]
          },
          {
            title:"全程纪实管理",icon:"el-icon-menu",
            dataList:[
              {name:"全程纪实查看",router:"/wholeManage/wholeCourseCheck",isSub:false},
              {name:"参与人员管理",router:"/wholeManage/participatorManagement",isSub:false}
            ]
          },
          {
            title:"全程纪实统计",icon:"el-icon-menu",
            dataList:[
              {name:"乡镇与街道统计",router:"/wholeCount/townshipAndStreetStatistics",isSub:false},
              {name:"机关会议统计",router:"/wholeCount/organMeetingStatistics",isSub:false},
              {name:"两新会议统计",router:"/wholeCount/twoNewMeetingStatics",isSub:false},
            ]
          },
          {
            title:"内容类型管理",icon:"el-icon-menu",
            dataList:[
              {name:"机关内容类型",router:"/conTypeMange/partyConType",isSub:false},
              {name:"两新内容类型",router:"/conTypeMange/twoConType",isSub:false}
            ]
          },
          {
            title:"视频会议管理",icon:"el-icon-menu",
            dataList:[
              {name:" 会议中会议管理",router:"/videConfer/inMeeting",isSub:false},
              {name:"固定会议管理",router:"/videConfer/fixedMeetingRoomMmanagement",isSub:false},
              {name:"历史会议查看",router:"/videConfer/historyMeeting",isSub:false},
              {name:"会议室列表",router:"/videConfer/meetingRoomList",isSub:false},
              {name:"会议管理",router:"/videConfer/meetingManage",isSub:false},
            ]
          },
          {
            title:"城市与农村党建",icon:"el-icon-menu",
            dataList:[
              {name:"乡镇资料管理",router:"/cityCountry/townshipDataManagemen",isSub:false},
              {name:"村资料管理",router:"/cityCountry/villageData",isSub:false},
            ]
          },
          {
            title:"视频点播管理",router:"/videoOnDemand",icon:"el-icon-menu"
          },
          {
            title:"便民服务管理",icon:"el-icon-menu",
            dataList:[
              {name:"惠农政策管理",router:"/memberServer/benefitPolicy",isSub:false},
              {name:"便民电话",router:"/memberServer/conveniencePhone",isSub:false},
              {name:"招聘信息",router:"/memberServer/recruitInfo",isSub:false},
            ]
          },
          {
            title:"电视节目管理",router:"/TVprogram",icon:"el-icon-menu"
          },
          {
            title:"智慧党建O2O",router:"/wisParBuild",icon:"el-icon-menu"
          },
          {
            title:"信息与通知",router:"/InformNotify",icon:"el-icon-menu"
          },
          {
            title:"首页视频管理",router:"/homeVidManage",icon:"el-icon-menu"
          },
          {
            title:"平台设备管理",icon:"el-icon-menu",
            dataList:[
              {name:"前端设备管理",router:"/platformDevice/frontManage",isSub:false},
              {name:"全程纪实监控设备",router:"/platformDevice/watchdog",isSub:false}
            ]
          },
          {
            title:"修改密码",router:"/",icon:"el-icon-menu"
          },
        ]
      }
    },
    computed: {
      pageindex: function () {
        return window.localStorage.getItem('page')
      }
    }
  }
</script>

<style lang="less">
  .el-menu-item a {
    display: block;
    color: black;
    text-decoration: none;
  }

  .el-menu-item.is-active a {
    color: #409eff;
  }
</style>
